package com.example.kehoobackend.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.example.kehoobackend.domain.Comment;

import java.util.List;
import java.util.Map;

public interface CommentService extends IService<Comment> {

    //显示最新评论
    List<Comment> getNewestComments(Integer from_id,Integer to_id,Integer type);

    //默认显示评论
    List<Comment> getDefaultComments(Integer from_id,Integer to_id,Integer type);

    //点赞评论
    boolean like(Integer comment_id,Integer user_id);

    //取消点赞
    boolean cancelLike(Integer comment_id,Integer user_id);

    //发送评论
    Comment commentOn(Comment comment);

    //删除评论
    boolean deleteComment(Integer comment_id);

    //某用户是否已点赞某评论
    boolean isLike(Integer comment_id,Integer user_id);

    List<Comment> getCommentsByLikeDesc(Integer from_id,Integer to_id, Integer type);

    // 将List<Comment>转为Map<Comment,List<Comment>>
    // Map<Comment,List<Comment>> : key为父评论，value为其下的子评论
    List<Comment> getCommentResponses(List<Comment> comments);
}
